/**
 * fengbin 2007-11-29
 */
package com.wsj.web.action.test;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.wsj.util.tool.SendEmailUtil;
import com.wsj.web.form.test.SendEmailTestForm;

/**
 * @author fengbin
 *
 * create date:2007-11-29
 * 
 * 电子邮件发送测试bean
 */
public class SendEmailTestAction extends Action{
	
	//电子邮件发送
	SendEmailUtil sendEmailUtil;
	
	
	public ActionForward execute(
			ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) {
		
		SendEmailTestForm sendEmailTestForm=(SendEmailTestForm)form;
		
		boolean isok=sendEmailUtil.sendEmail(sendEmailTestForm.getUserPassportName(),sendEmailTestForm.getUserEmail());
		if(isok)
		{
			System.out.println("发送电子邮件成功!");
		}
		else
		{
			System.out.println("发送电子邮件失败!");
		}
		
		 return mapping.findForward("success");
	}


	public SendEmailUtil getSendEmailUtil() {
		return sendEmailUtil;
	}


	public void setSendEmailUtil(SendEmailUtil sendEmailUtil) {
		this.sendEmailUtil = sendEmailUtil;
	}
	
	

}
